<template>
  <div>

    <!--    <div class="province">
          <el-dropdown trigger="click">
            <div class="provincediv" @click="navigationA">
              <span class="provincespan">省/直辖市</span>
              <i class="float" :class="{ 'el-icon-arrow-up' : isa, 'el-icon-arrow-down': !isa}"></i>
            </div>
            <el-dropdown-menu slot="dropdown">
              <ul class="ul">
                <li><input class="ipt" type="text" placeholder="省/直辖市"></li>
                <li><span>深圳</span></li>
                <li><span>深圳</span></li>
                <li><span>深圳</span></li>
              </ul>
            </el-dropdown-menu>
          </el-dropdown>
        </div>-->

    <div>
      <el-select v-model="value7" filterable placeholder="请输入省/直辖市">
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value">
        </el-option>
      </el-select>

      <el-select v-model="value8" filterable placeholder="请输入市">
        <el-option
          v-for="item in cities"
          :key="item.value"
          :label="item.label"
          :value="item.value">
        </el-option>
      </el-select>
    </div>


    <!--    <div>
          <el-select v-model="value7" placeholder="省/直辖市">
            <el-option-group
              v-for="group in options3"
              :key="group.label"
              :label="group.label">
              <el-option
                v-for="item in group.options"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-option-group>
          </el-select>
          <el-select v-model="value8" placeholder="市">
            <el-option-group
              v-for="group in options3"
              :key="group.label"
              :label="group.label">
              <el-option
                v-for="item in group.options"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-option-group>
          </el-select>
        </div>-->

  </div>
</template>

<script>
  import bus from '../../../bus';
  export default {
    data() {
      return {
        isa: false,
        options: [
          {
          value: '北京市',
          label: '北京市'
        },
          {
          value: '河北省',
          label: '河北省'
        },
          {
          value: '河南省',
          label: '河南省'
        }
          ,
          {
            value: '上海',
            label: '上海市'
          }
        ],
        options1: [
          {
            value: '北京市',
            label: '北京市',
            parent: '北京市'
          },
          {
            value: '上海',
            label: '上海市',
            parent: '上海市'
          },
          {
            value: '石家庄市',
            label: '石家庄市',
            parent: '河北省'
          },
          {
            value: '唐山式',
            label: '唐山式',
            parent: '河北省'
          },
          {
            value: '秦皇岛市',
            label: '秦皇岛市',
            parent: '河北省'
          },
          {
            value: '邯郸市',
            label: '邯郸市',
            parent: '河北省'
          },
          {
            value: '邢台市',
            label: '邢台市',
            parent: '河北省'
          },
          {
            value: '郑州市',
            label: '郑州市',
            parent: '河南省'
          },
          {
            value: '开封市',
            label: '开封市',
            parent: '河南省'
          },
          {
            value: '洛阳市',
            label: '洛阳市',
            parent: '河南省'
          },
          {
            value: '平顶山市',
            label: '平顶山市',
            parent: '河南省'
          },
          {
            value: '安阳市',
            label: '安阳市',
            parent: '河南省'
          },
          {
            value: '鹤壁市',
            label: '鹤壁市',
            parent: '河南省'
          },

        ],
        value7: '',
        value8: '',
        refresh:true,
      }
    },

    watch: {
      value7() {
        this.value8 = '';
        bus.$emit('refresh', this.refresh);
        bus.$emit('value7', this.value7);
/*        console.log(this.value7);*/
/*        this.$axios.get('http://tlpt.yutaolife007.com/huimeidata/getHcps?city='+this.value7).then(response => {
          console.log(response.data);
        }, response => {
          console.log("error");
        });*/
      },
      value8(){
        bus.$emit('refresh', this.refresh);
      },

    },
    computed: {
      cities() {
        return this.options1.filter(item => item.parent === this.value7)
      }
    },
    methods: {
      navigationA() {
        this.isa = !this.isa;
      },
    }
  }
</script>
<style scoped>
  .province {
    width: 90%;
    height: 30px;
    line-height: 30px;
    font-size: 16px;
    margin-bottom: 12px;
  }

  .el-dropdown {
    display: block !important;
  }

  .provincediv {
    width: 100%;
    text-align: center;
    background-color: rgba(246, 242, 226, 0.4);
    color: #ababab;
    border-radius: 4px;
  }

  .provincespan {
    display: inline-block;
  }

  .el-dropdown-menu {
    width: 200px;
  }

  .ipt {
    text-align: center;
    height: 30px;
    width: 100%;
    border-radius: 4px;
  }

  .ipt::-webkit-input-placeholder {
    color: #999;
    font-size: 14px;
  }

  .ul > li {
    font-size: 14px;
    padding: 0 20px;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #606266;
    height: 34px;
    line-height: 34px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    cursor: pointer;
  }

  .ul > li:hover {
    background-color: #f5f7fa;
  }
</style>
<style>
  .btn {
    width: 100%;
    display: inline-block;
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.42857143;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background-image: none;
    background: #fff;
    border: 1px solid transparent;
    /*    outline: none;*/
  }

  .el-select {
    width: 90%;
  }

  .el-input--suffix .el-input__inner {
    margin-bottom: 12px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    border: 0;
    border-radius: 4px;
    background-color: rgba(246, 242, 226, 0.4);
    font-size: 12px;
    color: #ababab;
  }

  .el-input__prefix, .el-input__suffix {
    position: absolute;
    top: -5px;
  }
</style>
